//
// CTessFacePriorityList.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.CVector;

public class CTessFacePriorityList {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CTessFacePriorityList(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CTessFacePriorityList obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nel3dJNI.delete_CTessFacePriorityList(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public CTessFacePriorityList() {
    this(nel3dJNI.new_CTessFacePriorityList(), true);
  }

  public void init(float distStep, long numEntries, float distMaxMod, long numQuadrant) {
    nel3dJNI.CTessFacePriorityList_init(swigCPtr, this, distStep, numEntries, distMaxMod, numQuadrant);
  }

  public void clear() {
    nel3dJNI.CTessFacePriorityList_clear(swigCPtr, this);
  }

  public long selectQuadrant(CVector direction) {
    return nel3dJNI.CTessFacePriorityList_selectQuadrant(swigCPtr, this, CVector.getCPtr(direction), direction);
  }

  public CVector getQuadrantDirection(long quadrantId) {
    return new CVector(nel3dJNI.CTessFacePriorityList_getQuadrantDirection(swigCPtr, this, quadrantId), false);
  }

  public void insert(long quadrantId, float distance, CTessFace value) {
    nel3dJNI.CTessFacePriorityList_insert(swigCPtr, this, quadrantId, distance, CTessFace.getCPtr(value), value);
  }

  public void shift(CVector direction, CTessFacePListNode pulledElements) {
    nel3dJNI.CTessFacePriorityList_shift(swigCPtr, this, CVector.getCPtr(direction), direction, CTessFacePListNode.getCPtr(pulledElements), pulledElements);
  }

  public void shiftAll(CTessFacePListNode pulledElements) {
    nel3dJNI.CTessFacePriorityList_shiftAll(swigCPtr, this, CTessFacePListNode.getCPtr(pulledElements), pulledElements);
  }

}
